﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace Zove.Desktop {
    public class MessageTabPageCollection : List<TabPage> {

        private System.Windows.Forms.TabControl.TabPageCollection collection = null;

        public MessageTabPageCollection(System.Windows.Forms.TabControl.TabPageCollection collection) {
            this.collection = collection;
        }

        public TabPage this[string tabName] {
            get {
                TabPage page = collection[tabName];
                if (page == null) {
                    page = new TabPage();

                    MessageGridView gridView = new MessageGridView();
                    gridView.Name = "MessageGridView";
                    gridView.Dock = DockStyle.Fill;

                    page.Controls.Add(gridView);

                    this.collection.Add(page);
                }

                return page;
            }
        }
    }
}
